import java.util.concurrent.Semaphore;

public class Test {
    public static void main(String[] args) throws InterruptedException {
        Semaphore semaphore=new Semaphore(3);
        semaphore.acquire();
        System.out.println("P操作一次");
        semaphore.acquire();
        System.out.println("P操作一次");
        semaphore.acquire();
        System.out.println("P操作一次");

        semaphore.release();
        semaphore.acquire();
        System.out.println("P操作一次");

    }
}
